<template>
    <!-- 确认对话框组件 -->
  <Transition name="dialog">
    <div v-if="visible" class="dialog-overlay" @click.self="emit('cancel')">
      <div class="dialog-box">
        <p class="dialog-content">是否确认要删除已读通知</p>
        <div class="dialog-actions">
          <button class="btn btn-confirm" @click="emit('confirm')">确认删除</button>
          <button class="btn btn-cancel" @click="emit('cancel')">取消</button>
        </div>
      </div>
    </div>
  </Transition>
</template>

<script setup lang="ts">
defineProps<{ visible: boolean }>();
const emit = defineEmits(['confirm', 'cancel']);
</script>

<style scoped lang="scss">
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.dialog-box {
  background-color: white;
  border-radius: 12px;
  width: 80%;
  max-width: 300px;
  text-align: center;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.dialog-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.dialog-content {
font-weight: 600;
font-size: 17px;
color: #333333;
line-height: 17px;
text-align: center;
font-style: normal;
padding-bottom: 40px;
padding-top: 30px;
}

.dialog-actions {
  display: flex;
}

.btn {
  flex: 1;
  padding: 20px;
  border: none;
  font-size: 19px;
  cursor: pointer;
  border-top: 1px solid #E5E5E5;
  background-color: white;
  &.btn-cancel {
    // background-color: #f0f0f0;
    color: #00C8BE;
    border-left: 1px solid #E5E5E5;
  }
  &.btn-confirm {
    // background-color: #d9534f;
    color: #999999;
  }
}

// Dialog Animation
.dialog-enter-active, .dialog-leave-active {
  transition: opacity 0.2s ease;
  .dialog-box {
    transition: transform 0.2s ease;
  }
}
.dialog-enter-from, .dialog-leave-to {
  opacity: 0;
  .dialog-box {
    transform: scale(0.9);
  }
}
</style>